package com.spring.validator_test;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.NotBlank;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.format.annotation.NumberFormat;

import javax.validation.ConstraintViolation;
import javax.validation.constraints.*;
import java.util.Date;
import java.util.Set;


public class Employee {
	@NotNull
	private String name;
	@NotNull
	@Max(12)
	private Integer age;
	@DateTimeFormat(pattern = "yyyy-MM-dd")
	private Date birth;
	@NumberFormat(pattern = "#.##")
	private Float salary;

	public Employee() {
	}

	public Employee(@NotBlank String name, @Max(value = 200) Integer age, Date birth, Float salary) {
		this.name = name;
		this.age = age;
		this.birth = birth;
		this.salary = salary;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getAge() {
		return age;
	}

	public void setAge(Integer age) {
		this.age = age;
	}

	public Date getBirth() {
		return birth;
	}

	public void setBirth(Date birth) {
		this.birth = birth;
	}

	public Float getSalary() {
		return salary;
	}

	public void setSalary(Float salary) {
		this.salary = salary;
	}


}
